<!--{template ADMIN_DIRECTORY/tpl/admin_header}-->


<div class="page_title">
    	<h1>{$_lang['db_mange']}</h1>
         <div class="tool">         
            <a href="index.php?do=tool&view=dbbackup" class="here">{$_lang['backup']}</a>
            <a href="index.php?do=tool&view=dbrestore">{$_lang['restore']}</a>
			<a href="index.php?do=tool&view=dboptim">{$_lang['optim']}</a>
			<a href="index.php?do=tool&view=dboptim&op=repair">{$_lang['repair']}</a>
		</div>
</div>
<div class="box list">
  <div class="detail">
    <div class="tabcon">
     <div class="title"><h2>{$_lang['database_backup']}</h2></div>
		<form method="post" action="#" id="frm_cat_edit">
   			<input type="hidden" name="do" value="{$do}">
			<input type="hidden" name="view" value="{$view}">
          	 <table cellpadding="0" cellspacing="0">
           	  <tbody>
            	  <tr class="item">
              		<td width="300"><img src="tpl/img/SQl15bg.gif"></td>
              		<td class="loading" align="center">{DBNAME}</td>
              		<td width="300">
              			<button type="button" name="sbt_edit" id="backup" class="primary positive pill button">
              				<span class="book icon"></span>{$_lang['backup_now']}
						</button>
					</td>
             	 </tr>
          	 </tbody>
             </table>
       </form>
    </div>
 </div><div class="backshow"></div>
</div>
<script type="text/javascript">
	$("#backup").click(function(){
		$.ajax({
			url:"index.php?do=tool&view=dbbackup&sbt_edit=1",
			dataType:'json',
			beforeSend:function(){
				$(".loading").html("{$_lang['building']}</br><img src='tpl/img/loading.gif'>");
			},
			success:function(json){
				if(json.status==1){
					$.each(json.data,function(i,n){
						str = "<p>{$_lang['backup_table']}"+n+"{$_lang['success']}</p>";
						if(i==0){
							$(".detail").html(str);
						}else{
							$(".detail").append(str);
						}
						$("html,body").animate({scrollTop:$(".backshow").offset().top},50);
						if(i+1==json.data.length){
							setTimeout("winReload(1)",6500);
						}
					})
				}else{
					setTimeout("winReload(0)",1500);
				}
			},
		error:function(){
				setTimeout("winReload(0)",1500);
		}
	})
})

function winReload(t){
	window.location.replace("index.php?do=tool&view=dbbackup&t="+t);
}
</script>
<!--{template ADMIN_DIRECTORY/tpl/admin_footer}-->
